<%@page import="at.com.vn.chess.entity.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%! String rootPath = ""; %>
<% rootPath = application.getContextPath(); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>vn shogi - login</title>
<link href="<%=rootPath %>/pages/styles.css" type="text/css" media="screen" rel="stylesheet">

<script type="text/javascript">
	function validateForm() {
		if (document.myform.un.value == "") {
			alert("please input user name");
			document.myform.un.focus();
			return false;
		} else if (document.myform.pw.value == "") {
			alert("please input password");
			document.myform.pw.focus();
			return false;
		}
		return true;
	}
</script>
</head>
<body id="login" onLoad="document.forms[0].un.focus()">
	<%
		String userId = "";
		String errMessage = (String) session.getAttribute("errMessage");
		User inputUser = (User) session.getAttribute("inputUser");

		session.removeAttribute("errMessage");
		session.removeAttribute("inputUser");

		if ( inputUser != null ) {
			userId = inputUser.getUser_id();
		}
	%>
	<div id="wrappertop"></div>
	<div id="wrapper">
		<div id="content">
			<div id="header">
				<h1>
					<a href=""><img src="<%=rootPath %>/images/logo.png" alt="ChessApplication">
					</a>
				</h1>
			</div>
			<div id="darkbanner" class="banner320">
				<h2>Login</h2>
			</div>
			<div id="darkbannerwrap"></div>
			<form name="myform" method="post" action="LoginServlet">
				<fieldset class="form">
					<%
						if (errMessage != null && !errMessage.equals("")) {
					%>
					<p class="error">
						<img src="images/error.png" height="16px" width="16px">
						<%=errMessage%>
					</p>
					<%
						}
					%>
					<p>
						<label for="user_name">Username*:</label> <input name="un" id="un"
							value="<%=userId%>" type="text" />
					</p>
					<p>
						<label for="user_password">Password*:</label> <input name="pw"
							id="pw" type="password" />
					</p>
					<button type="submit" class="positive" name="Submit">
						<img src="images/key.png" alt="Announcement" />Login
					</button>
					<ul id="forgottenpassword">
						<li class="boldtext">I</li>
						<li><a href="<%=rootPath %>/pages/forgot.html">Forgotten
								it?</a></li>
					</ul>
				</fieldset>
			</form>
		</div>
	</div>

	<div id="wrapperbottom_branding">
		<div id="wrapperbottom_back_text">
			<a href="<%=rootPath %>/pages/register.jsp">sign up for free</a>
		</div>
	</div>
	<jsp:include page="footer_copyright.jsp" />
</body>
</html>
